<template>
  <div class="admin-web-me">
    <el-form
      ref="form"
      :model="form"
      label-width="100px">
      <el-form-item label="home/头像">
        <w-image-up
          ref="UP_IMAGE"
          :souce-url="form.home_icon"/>
      </el-form-item>
      <el-form-item label="home/标题">
        <el-input
          v-model="form.home_title"
          placeholder="标题"/>
      </el-form-item>
      <el-form-item label="home/简历">
        <el-input
          v-model="form.home_jianli"
          placeholder="简历链接地址"/>
      </el-form-item>

      <el-form-item label="关于我">
        <el-input
          v-model="form.abouts"
          type="textarea"
          placeholder="关于我"/>
      </el-form-item>

      <el-form-item label="专业技能">
        <el-input
          v-model="form.expertise"
          type="textarea"
          placeholder="专业技能"/>
      </el-form-item>

      <el-form-item label="工作经验">
        <el-input
          v-model="form.experience_show"
          type="textarea"
          placeholder="工作经验"/>
      </el-form-item>

      <el-form-item label="工作经历">
        <el-input
          v-model="form.works_show"
          type="textarea"
          placeholder="工作经历"/>
      </el-form-item>

      <el-form-item label="iOS">
        <el-slider
          v-model="form.iosNum"
          height="50"/>
      </el-form-item>

      <el-form-item label="iOS技能">
        <el-input
          v-model="form.iosShow"
          type="textarea"
          placeholder="技能说明"/>
      </el-form-item>

      <el-form-item label="Web前端">
        <el-slider v-model="form.webNum"/>
      </el-form-item>

      <el-form-item label="Web技能">
        <el-input
          v-model="form.webShow"
          type="textarea"
          placeholder="技能说明"/>
      </el-form-item>

      <el-form-item label="Node.js">
        <el-slider
          v-model="form.nodeNum"/>
      </el-form-item>

      <el-form-item label="Node技能">
        <el-input
          v-model="form.nodeShow"
          type="textarea"
          placeholder="技能说明"/>
      </el-form-item>

      <el-form-item label="小程序">
        <el-slider
          v-model="form.xcxNum"/>
      </el-form-item>

      <el-form-item label="小程序技能">
        <el-input
          v-model="form.xcxShow"
          type="textarea"
          placeholder="技能说明"/>
      </el-form-item>

      <el-form-item label="Java">
        <el-slider
          v-model="form.javaNum"/>
      </el-form-item>

      <el-form-item label="Java技能">
        <el-input
          v-model="form.javaShow"
          type="textarea"
          placeholder="技能说明"/>
      </el-form-item>

      <el-form-item>
        <el-button
          size="mini"
          type="primary"
          @click="onSubmit">确定</el-button>
      </el-form-item>

    </el-form>
  </div>
</template>

<script>
import MeModel from '@/models/web/MeModel'
import WImageUp from '@/components/global/imageUp/oss'
export default {
  name: 'AdminWebMe',
  components: {
    WImageUp
  },
  data() {
    return {
      form: new MeModel()
    }
  },
  mounted() {
    // 获取所有的数据
    this.getMeData()
  },
  methods: {
    // 提交修改的数据
    async onSubmit() {
      try {
        this.form.home_icon = await this.$refs['UP_IMAGE'].upImage()
        this.form.addOrUpdate(true).then(() => {}).catch(() => {})
      } catch (e) {
        console.log(e)
      }
    },
    // 获取所有的数据
    getMeData() {
      this.form.getModel().w_then()
    }
  }
}
</script>

<style scoped>

</style>
